import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '测站编码',
    align:"center",
    dataIndex: 'stcd'
   },
   {
    title: '测站名称',
    align:"center",
    dataIndex: 'stnm'
   },
   {
    title: '时间',
    align:"center",
    dataIndex: 'tm',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '闸上水位',
    align:"center",
    dataIndex: 'upz'
   },
   {
    title: '闸下水位',
    align:"center",
    dataIndex: 'dwz'
   },
   {
    title: '总过闸流量',
    align:"center",
    dataIndex: 'tgtq'
   },
   {
    title: '闸水特征码',
    align:"center",
    dataIndex: 'swchrcd'
   },
   {
    title: '闸上水势',
    align:"center",
    dataIndex: 'supwptn'
   },
   {
    title: '闸下水势',
    align:"center",
    dataIndex: 'sdwwptn'
   },
   {
    title: '测流方法',
    align:"center",
    dataIndex: 'msqmt'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '测站编码',
    field: 'stcd',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入测站编码!'},
          ];
     },
  },
  {
    label: '测站名称',
    field: 'stnm',
    component: 'Input',
  },
  {
    label: '时间',
    field: 'tm',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入时间!'},
          ];
     },
  },
  {
    label: '闸上水位',
    field: 'upz',
    component: 'Input',
  },
  {
    label: '闸下水位',
    field: 'dwz',
    component: 'Input',
  },
  {
    label: '总过闸流量',
    field: 'tgtq',
    component: 'Input',
  },
  {
    label: '闸水特征码',
    field: 'swchrcd',
    component: 'Input',
  },
  {
    label: '闸上水势',
    field: 'supwptn',
    component: 'Input',
  },
  {
    label: '闸下水势',
    field: 'sdwwptn',
    component: 'Input',
  },
  {
    label: '测流方法',
    field: 'msqmt',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}